#include "head.h"

int epoll_add(int epoll_fd, int fd)
{
    struct epoll_event event;
    event.events = EPOLLIN;
    event.data.fd = fd;

    if(epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fd, &event) == -1)
        error(1, errno, "epoll_ctl");
        
    return 0;
}

// 移除 epoll 监听
int epoll_del(int epoll_fd, int fd)
{
    if(epoll_ctl(epoll_fd, EPOLL_CTL_DEL, fd, NULL) == -1)
        error(1, errno, "epoll_ctl");
        
    return 0;
}